/**
* Class to manage a generic datamodel for table properties
*
* Project: QA
* Author:  TM
* Date:    07/04/2013
*
* History
* ------------------
* 07/04/2013 - TM - Initial version.
*/
 
 
package DataModel;

import java.util.*;

public abstract class dmCustom
{
   /** Variables */
   protected String  tableName;
   protected Vector  fields;
   
   /** Constructor */
   public dmCustom(String tbName)
   {
     tableName = tbName;
     fields    = createFields();
   }
   
   /** Get field by name */
   public libField getFieldByName(String fieldName)
   {
     libField result = null;
     libField currField;
     
     if (fields == null || fields.size() == 0)
       return result;
     
     for(int i=0;i<fields.size(); i++)
     {
       currField = (libField)(fields.elementAt(i));
       if (currField.getName().equals(fieldName))
       {
         result = currField;
         break;  
       }
     }
     
     return result;
   }
   
   //GETTERS
   public String     getTableName()    {return tableName;}
   public Vector     getFields   ()    {return fields;}
   
   //ABSTRACT METHODS
   protected abstract Vector createFields();
   

}